<template>
  <div class="news-detail">
    <myheader titleName="资讯详情"></myheader>
    <div>
      <h1 class="news-title">{{newsDetail.title}}</h1>
      <p class="news-info">
        <span>{{newsDetail.add_time|ctime}}</span>
        <span>点击{{newsDetail.click}}次</span>
        <span>分类：新闻资讯</span>
      </p>
    </div>
    <div class="news-content" v-html="newsDetail.content"></div>
    <comment :id="$route.params.id"></comment>
  </div>
</template>
<script>
import { getNewsDetail } from '@/api'
import myheader from '@/components/myheader'
import comment from '@/components/comment'
export default {
  components: {
    myheader,
    comment
  },
  data () {
    return {
      newsDetail: {}
    }
  },
  created () {
    this.initNewsDetail()
  },
  methods: {
    initNewsDetail () {
      getNewsDetail(this.$route.params.id)
        .then(res => {
          this.newsDetail = res.message[0]
        })
    }
  }
}
</script>

<style lang="scss" scoped>
.news-detail {
  padding: 40px 0 0 0;
  .news-title {
    font-size: 14px;
    font-weight: bold;
  }
  .news-info {
    font-size: 12px;
    color: #26a2ff;
    display: flex;
    justify-content: space-between;
  }
  .news-content {
    font-size: 12px;
  }
}
</style>
